package com.bupt.smart.ui.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.bupt.smart.smart.R;
import com.bupt.smart.utils.SaveSharedPreference;

import gr.net.maroulis.library.EasySplashScreen;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        View easySplashScreenView = null;
        if (SaveSharedPreference.getUserLoginStatus(SplashActivity.this) == true) {
            easySplashScreenView = new EasySplashScreen(SplashActivity.this)
                    .withFullScreen()
                    .withTargetActivity(TabActivity.class)
                    .withSplashTimeOut(4000)
                    .withBackgroundResource(android.R.color.white)
                    .withFooterText("Copyright 2016")
                    .withBeforeLogoText("阿米歌智慧社区")
                    .withLogo(R.drawable.logo)
                    .withAfterLogoText("做最专业的智慧社区")
                    .create();
        } else {
            easySplashScreenView = new EasySplashScreen(SplashActivity.this)
                    .withFullScreen()
                    .withTargetActivity(LoginActivity.class)
                    .withSplashTimeOut(4000)
                    .withBackgroundResource(android.R.color.white)
                    .withFooterText("Copyright 2016")
                    .withBeforeLogoText("阿米歌智慧社区")
                    .withLogo(R.drawable.logo)
                    .withAfterLogoText("做最专业的智慧社区")
                    .create();
        }
        setContentView(easySplashScreenView);
    }
}
